#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "vm.h"

#ifndef PARSER_H_INCLUDED
#define PARSER_H_INCLUDED

typedef struct Ref
{
	char name[16];
	int isConst;
	int index;
	int arraySize;
} Ref;

typedef struct Scope
{
	int nRef, space;
	Ref* refs;
	struct Scope* parent;
} Scope;

int find_ref(const char* name, Scope* scope, int* ll, Ref** ref);
void add_ref(Scope* scope, Ref* src);
const char* symname(int sym);
int parse_program();

#endif

